import service from "../utils/request";
//  列表
export function getLayer2SubnetList(params:any) {
  return service.get(`/subnet`, {params});
}
// 增
export function createLayer2Subnet(data:any) {
  return service.post(`/subnet`, data);
}
// 改
export function editLayer2Subnet(id:number,data:any) {
  return service.put(`/subnet/${id}`,data);
}
// 是否启用
export function editEnabled(id:number,data:any) {
  return service.put(`/subnet/${id}/enable`,data);
}
// 是否共享
export function editShared(id:number,data:any) {
  return service.put(`/subnet/${id}/share`,data);
}
// 删
export function deleteLayer2Subnet(id:number) {
  return service.delete(`/subnet/${id}`);
}
// 查
export function getLayer2SubnetDetail(id:number) {
  return service.get(`/subnet/${id}`);
}

//  二层子网 - IP地址(已使用)
export function getIpUsedList(params:any,id:any) {
  return service.get(`/subnet/${id}/used`, {params});
}
//  二层子网 - IP地址(已保留)
export function getIpReservedList(params:any,id:any) {
  return service.get(`/subnet/${id}/reserved`, {params});
}
//  二层子网 - 关联子网-列表
export function getIpNetworkList(params:any,id:any) {
  return service.get(`/subnet/${id}/network`, {params});
}
//  二层子网 - 关联项目-列表
export function getIpProjectList(params:any,id:any) {
  return service.get(`/subnet/${id}/project`, {params});
}
// 增
export function createIp(id:any,type:string,data:any) {
  return service.post(`/subnet/${id}/${type}`, data);
}
// 删
export function deleteIp(id:number,type:string,ids:any) {
  return service.delete(`/subnet/${id}/${type}/${ids}`);
}
// ip变更记录
export function getIpLogList(params:any) {
  return service.get(`/ip/record`, {params});
}
// 二层子网 - IP地址(已保留) -获取未分配的ip地址
export function getIpUndistributedList(params:any,id:any) {
  return service.get(`/subnet/${id}/undistributed`);
  // return service.get(`/subnet/${id}/undistributed`, {params});
}